﻿using System;
using System.Web.Mvc;
using Company.Model;
using Company.Model.Services;
using Company.Services;
using Company.Web.Infrastructure;
using Company.Web.Model;

namespace Company.Web.Controllers
{
    [Authorize]
    public class HomeController : Controller
    {
        private ISessionService m_SessionService = new SessionService();
        private IHomeViewTask m_HomeViewTask = new HomeViewTask();

        public ActionResult Index(string CompanyName)
        {
            Bootstrapper.StructureMapBD(CompanyName);
            return RedirectToAction("Home", "Home");
        }

        public ActionResult Home()
        {
            return View("Index", m_HomeViewTask.GetDefaultView());
        }
       
        [ChildActionOnly]
        public ActionResult Top()
        {
            ICommonView m_View = new CommonView();
            ISessionData Data = m_SessionService.GetCurrentSessionData();
            m_View.CurrentDate = DateTime.Now.ToShortDateString();
            m_View.UserName = Data.UserName;
            return View("Top", m_View);
        }

    }
}
